typedef int  int32;
typedef short  int16;
typedef char  int8;
typedef unsigned short  uint16;
typedef unsigned int  uint32;
typedef unsigned char  uint8;


#define BLOCK_HEIGTH 16 //16
#define BLOCK_WIDTH 16 //16
#define MAX_MOTION 24 //16
const int SEARCH_RANGE=MAX_MOTION*2+1;

#define MAX_PIC_WIDTH  2048
#define MAX_PIC_HEIGHT 2048

#define SAD_MAX        8000


typedef struct{
	int16 dx;
	int16 dy;
}MV;
//uint8 _flag_search[SEARCH_RANGE][SEARCH_RANGE];
uint8 _flag_search[64][64];
uint8 (*const flag_search)[SEARCH_RANGE]=
	(uint8 (*)[SEARCH_RANGE])&_flag_search[MAX_MOTION][MAX_MOTION];

struct{
	MV mv[MAX_PIC_HEIGHT/BLOCK_HEIGTH][MAX_PIC_WIDTH/BLOCK_WIDTH][4];
	uint32 sad[MAX_PIC_HEIGHT/BLOCK_HEIGTH][MAX_PIC_WIDTH/BLOCK_WIDTH];
	uint32 frame_sad;
	uint32 sum_sad;
	uint32 frame_pot;
	uint32 sum_pot;
}frame_info;

